#define _CRT_SECURE_NO_WARNINGS
#include <iostream>

using namespace std;
typedef long long LL;
const int N = 3e6 + 10;
LL inv[N];
LL n, p;

int main()
{
	scanf("%lld%lld", &n, &p);
	inv[1] = 1;
	
	for (int i = 2; i <= n; i++)
	{
		inv[i] = p - p / i * (inv[p % i]) % p;	
	}
	for (int i = 1; i <= n; i++)
	{
		printf("%lld\n", inv[i]);
	}
	return 0;
}